package me.xue.communityhealth.repo;

import me.xue.communityhealth.model.DrugType;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository;

import java.util.List;

@Mapper
@Repository
public interface DrugTypeRepository {

    @Insert("INSERT INTO `drug_type`(type) VALUES(#{type})")
    int save(DrugType drugType);

    @Update("UPDATE `drug_type` SET type=#{type} WHERE id=#{id}")
    int update(DrugType drugType);

    @Delete("DELETE FROM `drug_type` WHERE id=#{id}")
    int delete(Integer id);

    @Select("SELECT * FROM `drug_type` WHERE id=#{id}")
    DrugType findOne(Integer id);

    @Select("SELECT * FROM `drug_type`")
    List<DrugType> findAll();

}
